﻿using System.Collections.Generic;
using System.Linq;
using LBoL.Base;
using LBoL.ConfigData;
using LBoL.Core;
using LBoL.Core.Battle;
using LBoL.Core.Battle.BattleActions;
using LBoL.Core.Battle.Interactions;
using LBoL.Core.Cards;
using LBoL.Core.StatusEffects;
using LBoLEntitySideloader.Attributes;
using ProbeMod.Cards.Template;
using ProbeMod.StatusEffects;

namespace ProbeMod.Cards
{
    public sealed class ProbeTouDef : ProbeCardTemplate
    {
        public override CardConfig MakeConfig()
        {
            CardConfig config = GetCardDefaultConfig();

            config.Rarity = Rarity.Uncommon;
            config.Type = CardType.Ability;
            config.TargetType = TargetType.Nobody;

            config.Colors = new List<ManaColor>() { ManaColor.Green };
            config.Cost = new ManaGroup() { Green = 1, Any = 1 };
            config.Cost = new ManaGroup() { Green = 1, Any = 1 };

            config.RelativeCards = new List<string>() { "ProbeCarrier", "ProbeMothership" };
            config.UpgradedRelativeCards = new List<string>() { "ProbeCarrier", "ProbeMothership" };

            config.Index = CardIndexGenerator.GetUniqueIndex(config);
            return config;
        }
    }

    /// <summary>
    /// 偷
    /// 坚持4/3回合，母舰航母就来了
    /// </summary>
    [EntityLogic(typeof(ProbeTouDef))]
    public sealed class ProbeTou : ProbeCard
    {
        public int NeverGiveUp => IsUpgraded ? 3 : 4;

        protected override IEnumerable<BattleAction> Actions(UnitSelector selector, ManaGroup consumingMana, Interaction precondition)
        {
            yield return BuffAction<ProbeTouSe>(count:NeverGiveUp);
        }
    }
}
